﻿#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESF.DMS.Entities;
using System.Data;
using ESF.General.Entity;
using ESF.DMS.Entities.Search;
using ESF.DMS.DataAccess.Search;

#endregion


namespace ESF.DMS.DataAccess
{
	public static class AdoFileReferenceWordHit
	{
		#region Write

		public static IDbCommand GenerateRegisterHit (FileReferenceWordHit pHit)
		{
			IDbCommand cmd;


			cmd = DBContext.W.CreateSPCommandWithoutTimeout ("esf_files.P_InsertFileReferenceWordHit");

			DBContext.W.AddIDParameter (cmd, "pFileReferenceID", pHit.FileReference.ID);
			DBContext.W.AddIDParameter (cmd, "pWordID", pHit.Word);
			DBContext.W.AddParameter (cmd, "pPageIndex", pHit.PageIndex);
			DBContext.W.AddIDParameter (cmd, "pWordPreviousID", pHit.WordPrevious);

			DBContext.W.AddParameter(cmd, "pWordText", pHit.WordText);
			DBContext.W.AddParameter(cmd, "pX0", pHit.X0);
			DBContext.W.AddParameter(cmd, "pY0", pHit.Y0);
			DBContext.W.AddParameter(cmd, "pX1", pHit.X1);
			DBContext.W.AddParameter(cmd, "pY1", pHit.Y1);

			return cmd;
		}


		public static void DeleteAll(FileReference pFile)
		{
			IDbCommand cmd;


			cmd = DBContext.W.CreateSPCommand("esf_files.P_DeleteAllFileReferenceWordHit");

			DBContext.W.AddIDParameter(cmd, "pFileReferenceID", pFile.ID);


			DBContext.W.Execute(cmd);
		}

		#endregion
	}
}
